/*
 * @Author: zhangyang
 * @Date: 2020-12-09 15:56:27
 * @LastEditTime: 2022-03-02 14:09:32
 * @Description: 用户相关的请求接口
 */
import { basicRequest, requestWithoutToken } from '@/modules/3-net';
import type { UserKey } from '@/typings/type';
import { Params } from '@/typings/type';

export const login = async (login_name: string, login_code: string): Promise<UserKey> => {
  const task = 1;
  return requestWithoutToken({
    com: Params.com,
    task,
    login_name,
    login_code
  });
};

export const login_out = async () => {
  const task = 2;
  return basicRequest({ com: Params.com, task });
};

export const getUserInfo = async () => {
  const task = 3;
  return basicRequest({ com: Params.com, task });
};

export const modifyPassword = async (old_pass: string, pass: string) => {
  const task = 4;
  return basicRequest({
    com: Params.com,
    task,
    old_pass,
    pass
  });
};
